package com.elinkway.infinitemovies.async;

import android.content.Context;

import com.elinkway.infinitemovies.bean.HomePageList;
import com.elinkway.infinitemovies.http.api.MoviesHttpApi;
import com.elinkway.infinitemovies.http.parser.MoreFeedParser;
import com.lvideo.http.bean.LVideoDataHull;

public class RequestFeedMoreTask extends MoviesHttpAsyncTask<HomePageList>{

	private String recid = "";
	private String vt = "";

	public RequestFeedMoreTask(Context context, String recid, String vt) {
		super(context);
		this.recid = recid;
		this.vt = vt;
	}

	@Override
	public LVideoDataHull<HomePageList> doInBackground() {
		return MoviesHttpApi.requestMoreDataData(new MoreFeedParser(), recid, vt);
	}
	private RequestResultListener <HomePageList> mListener;

	@Override
	public void onPostExecute(int updateId, HomePageList result) {
		if(null != mListener) {
			mListener.onRequestSuccess(updateId, result);
		}
	}

	public RequestResultListener <HomePageList> getListener() {
		return mListener;
	}

	@Override
	public void netNull() {
		super.netNull();
		if(null != mListener) {
			mListener.onRequestFailed();
		}
	}

	@Override
	public void netErr(int updateId, String errMsg) {
		super.netErr(updateId, errMsg);
		if(null != mListener) {
			mListener.onRequestFailed();
		}
	}

	@Override
	public void dataNull(int updateId, String errMsg) {
		super.dataNull(updateId, errMsg);
		if(null != mListener) {
			mListener.onRequestFailed();
		}
	}

	public void setListener(RequestResultListener <HomePageList> mListener) {
		this.mListener = mListener;
	}

}
